//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.itcoon.cloud.framework.utils;


public class OsInfoUtils {
    private static String OS = System.getProperty("os.name").toLowerCase();
    private EPlatform platform;

    public OsInfoUtils() {
    }

    public static boolean isLinux() {
        return OS.indexOf("linux") >= 0;
    }

    public static boolean isMacOS() {
        return OS.indexOf("mac") >= 0 && OS.indexOf("os") > 0 && OS.indexOf("x") < 0;
    }

    public static boolean isMacOSX() {
        return OS.indexOf("mac") >= 0 && OS.indexOf("os") > 0 && OS.indexOf("x") > 0;
    }

    public static boolean isWindows() {
        return OS.indexOf("windows") >= 0;
    }

    public static boolean isOS2() {
        return OS.indexOf("os/2") >= 0;
    }

    public static boolean isSolaris() {
        return OS.indexOf("solaris") >= 0;
    }

    public static boolean isSunOS() {
        return OS.indexOf("sunos") >= 0;
    }

    public static boolean isMPEiX() {
        return OS.indexOf("mpe/ix") >= 0;
    }

    public static boolean isHPUX() {
        return OS.indexOf("hp-ux") >= 0;
    }

    public static boolean isAix() {
        return OS.indexOf("aix") >= 0;
    }

    public static boolean isOS390() {
        return OS.indexOf("os/390") >= 0;
    }

    public static boolean isFreeBSD() {
        return OS.indexOf("freebsd") >= 0;
    }

    public static boolean isIrix() {
        return OS.indexOf("irix") >= 0;
    }

    public static boolean isDigitalUnix() {
        return OS.indexOf("digital") >= 0 && OS.indexOf("unix") > 0;
    }

    public static boolean isNetWare() {
        return OS.indexOf("netware") >= 0;
    }

    public static boolean isOSF1() {
        return OS.indexOf("osf1") >= 0;
    }

    public static boolean isOpenVMS() {
        return OS.indexOf("openvms") >= 0;
    }

    public static EPlatform getOSname() {
        if (isAix()) {
            return EPlatform.AIX;
        } else if (isDigitalUnix()) {
            return EPlatform.Digital_Unix;
        } else if (isFreeBSD()) {
            return EPlatform.FreeBSD;
        } else if (isHPUX()) {
            return EPlatform.HP_UX;
        } else if (isIrix()) {
            return EPlatform.Irix;
        } else if (isLinux()) {
            return EPlatform.Linux;
        } else if (isMacOS()) {
            return EPlatform.Mac_OS;
        } else if (isMacOSX()) {
            return EPlatform.Mac_OS_X;
        } else if (isMPEiX()) {
            return EPlatform.MPEiX;
        } else if (isNetWare()) {
            return EPlatform.NetWare_411;
        } else if (isOpenVMS()) {
            return EPlatform.OpenVMS;
        } else if (isOS2()) {
            return EPlatform.OS2;
        } else if (isOS390()) {
            return EPlatform.OS390;
        } else if (isOSF1()) {
            return EPlatform.OSF1;
        } else if (isSolaris()) {
            return EPlatform.Solaris;
        } else if (isSunOS()) {
            return EPlatform.SunOS;
        } else {
            return isWindows() ? EPlatform.Windows : EPlatform.Others;
        }
    }
}
